package day6;

import java.util.ArrayList;

//定义一个方法，ArrayList作为参数，括号为{}，用@分隔各个元素
public class ArrayListMethod {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("军哥");
        list.add("洋葱哥");
        list.add("头盔哥");
        list.add("天青");
        System.out.println(list);
        finishset(list);
    }

    public static void finishset(ArrayList<String> list) {
        System.out.print("{");
        for (int i = 0; i < list.size(); i++) {
            if (i == list.size() - 1) {
                System.out.print(list.get(i) + "}");
            } else {
                System.out.print(list.get(i) + "@");
            }
        }
    }
}
